<?php
	/* code here to:
			check current password				(checkUserPass($username, $password))
			update database to new password		(setPassword ($password))
	*/
	
	if (!checkUserPass($_SESSION['username'], $_POST['password'])) {
		if (setPassword($_POST['newpassword1'])) {
			echo '<h3>Change Your Password</h3>
					<p>Your password has been successfully changed!</p>
					';
		}
		else {
			echo '<h3>Change Your Password</h3>
					<p>There was an error changing your password details. Please try again. If the problem continues, please contact the administrator.</p>
					';
			include("flatshare_php/account_pwform.php");
		}
	}
	else {
		echo '<h3>Change Your Password</h3>
				<p>Your current password is incorrect. Please try again.</p>
				';
		include("flatshare_php/account_pwform.php");
	}
	
	
?>